//
//  MatchTableViewCell.m
//  MyDIYHouse
//
//  Created by dlios on 15-6-30.
//  Copyright (c) 2015年 李平洋. All rights reserved.
//

#import "MatchTableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation MatchTableViewCell

- (void)dealloc {
    [_homeImageView release];
    [_headButton release];
    [_starButton release];
    [_stylistName release];
    [_starNumber release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //房屋大图片
        self.homeImageView = [[UIImageView alloc] init];
        //self.homeImageView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.homeImageView];
        [_homeImageView release];
        
        //设计师头像按钮
        self.headButton = [UIButton buttonWithType:UIButtonTypeCustom];
        //self.headButton.backgroundColor = [UIColor cyanColor];
        self.headButton.layer.cornerRadius = 22.5;
        self.headButton.layer.masksToBounds = YES;
        [self.headButton addTarget:self action:@selector(headClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.headButton];
        
        
        ////收藏星星按钮
        self.starButton = [UIButton buttonWithType:UIButtonTypeCustom];
        //self.starButton.backgroundColor = [UIColor blackColor];
        self.starButton.tintColor = [UIColor whiteColor];
        [self.starButton setImage:[UIImage imageNamed:@"iconfont-shoucangxingxing.png"] forState:UIControlStateNormal];
        [self.starButton addTarget:self action:@selector(starClick:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.contentView addSubview:self.starButton];
        
        //设计师名称
        self.stylistName = [[UILabel alloc] init];
        //self.stylistName.backgroundColor = [UIColor blueColor];
        self.stylistName.textColor = [UIColor whiteColor];
        [self.homeImageView addSubview:self.stylistName];
        [_stylistName release];
        
        //收藏数量
        self.starNumber = [[UILabel alloc] init];
        //self.starNumber.backgroundColor = [UIColor blueColor];
        self.starNumber.textColor = [UIColor whiteColor];
        [self.homeImageView addSubview:self.starNumber];
        [_starNumber release];
        
        
        
        
        
        //        //设计师头像
        //        self.headImageView = [[UIImageView alloc] init];
        //        self.headImageView.backgroundColor = [UIColor cyanColor];
        //        self.headImageView.layer.cornerRadius = 22.5;
        //        [self.homeImageView addSubview:self.headImageView];
        //        [_headImageView release];
        //
        //        //收藏星星图
        //        self.starImageView = [[UIImageView alloc] init];
        //        self.starImageView.backgroundColor = [UIColor blackColor];
        //        self.starImageView.image = [UIImage imageNamed:@"iconfont-shoucangxingxing.png"];
        //        [self.homeImageView addSubview:self.starImageView];
        //        [_starImageView release];
        
        
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.homeImageView.frame = CGRectMake(0, 10, WIDTH, HEIGHT - 10);
    self.headButton.frame = CGRectMake(15, 200, 45, 45);
    self.starButton.frame = CGRectMake(330, 213, 20, 20);
    self.stylistName.frame = CGRectMake(67, 203, 130, 20);
    self.starNumber.frame = CGRectMake(351, 203, 20, 20);
}

- (void)starClick:(UIButton *)button {
    NSLog(@"星星button");
}

- (void)headClick:(UIButton *)button {
    NSLog(@"设计师头像button");
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
